{extend name="admin/base" /}
{block name="resources"}
<style>
	.img-box{width:60px;height:60px;border:1px dashed #4685fd;position: relative;display: flex;    overflow: hidden;}
	.img-info{
		width: 100%;
		height: 100%;
		margin: 0 auto;
		line-height: 100%;
		vertical-align: middle;
	}
	.default-img-logo{display:inline-block;width:25px}
	dl.input-item-inline {
		width: 32%;
		clear: unset;
		display: inline-block;
		box-sizing: border-box;
	}
	dl.input-item-inline dd{
		width: 48%;
	}
	.item-line {
		width: 36%!important;
	}
	.hint {
		color: rgba(0,0,0,.3);
		margin-top: 20px;
	}
</style>

{/block}
{block name="main"}
<div class="set-style">
	<h4><span></span>充值设置</h4>
	<dl>
		<dt>充值功能：</dt>
		<dd>
			<label for="navigationtype1" class="radio inline normal">
				<i class="radio-common {if condition="$recharge_config.enable eq 1"}selected{/if}">
				<input type="radio" value="1" name="enable" id="navigationtype1"  {if condition="$recharge_config.enable eq 1"}checked{/if}/>
				</i>
				<span>开启</span>
			</label>
			<label for="navigationtype2" class="radio inline normal">
				<i class="radio-common {if condition="$recharge_config.enable eq 0"}selected{/if}">
				<input type="radio" value="0" name="enable" id="navigationtype2"  {if condition="$recharge_config.enable eq 0"}checked{/if}/>
				</i>
				<span>关闭</span>
			</label>
		</dd>
	</dl>
	<dl>
		<dt></dt>
		<dd><button class="btn-common btn-big" onclick="setConfigAjax();">保存</button></dd>
	</dl>
</div>
<script>

    function setConfigAjax() {
        var enable = $("input[name='enable']:checked").val();

        $.ajax({
            type : "post",
            url : "{:__URL('ADMIN_MAIN/config/rechargeSet')}",
            data : {
                'enable' : enable,
            },
            success : function(data) {
                if (data["code"] > 0) {
                    showTip(data["message"],"success");
                    setTimeout(function(){window.location.reload();},2000);
                } else {
                    showTip(res.message,"error");
                }
            }
        });
    }
</script>
{/block}